//
//  BaseController.m
//  WashForU
//
//  Created by 王俊 on 15/11/24.
//  Copyright © 2015年 王俊. All rights reserved.
//

#import "BaseController.h"

@implementation BaseController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setUpView];
    [self addConstrains];
}

- (void)setUpView
{
    self.view.backgroundColor = [UIColor GrayColor_237];
    
    _upView = [[UIView alloc]init];
    _upView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_upView];
    
    _backButton = [[UIButton alloc]init];
    [_backButton setImage:[UIImage imageNamed:@"返回按钮"] forState:UIControlStateNormal];
    [self.upView addSubview:_backButton];
    
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    _titleLabel.font = [UIFont CustomFont:19];
    
    [self.upView addSubview:_titleLabel];
    
    
}

- (void)addConstrains
{
    [_upView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.top.trailing.equalTo(self.view);
        make.height.mas_equalTo(64);
    }];
    [_backButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(40, 40));
        make.centerY.equalTo(self.upView).offset(5);
        make.leading.equalTo(self.upView).offset(2);
    }];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(300, 40));
        make.centerX.equalTo(self.upView);
        make.centerY.equalTo(self.upView).offset(5);
    }];
    
}

/*******************设置backButton绑定事件********************/
- (void)backButtonClicked
{
    [self.navigationController popViewControllerAnimated:true];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}


@end
